home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicTableUI$MouseInputHandler.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  3.1 KB  |  103 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Point;
  5. import java.awt.event.InputEvent;
  6. import java.awt.event.MouseEvent;
  7. import javax.swing.SwingUtilities;
  8. import javax.swing.event.MouseInputListener;
  9. import javax.swing.table.TableCellEditor;
  10.  
  11. public class BasicTableUI$MouseInputHandler implements MouseInputListener {
  12.    // $FF: synthetic field
  13.    private final BasicTableUI this$0;
  14.    private Component dispatchComponent;
  15.  
  16.    public BasicTableUI$MouseInputHandler(BasicTableUI var1) {
  17.       this.this$0 = var1;
  18.    }
  19.  
  20.    public void mouseClicked(MouseEvent var1) {
  21.    }
  22.  
  23.    public void mouseDragged(MouseEvent var1) {
  24.       if (SwingUtilities.isLeftMouseButton(var1)) {
  25.          this.repostEvent(var1);
  26.          TableCellEditor var2 = this.this$0.table.getCellEditor();
  27.          if (var2 == null || var2.shouldSelectCell(var1)) {
  28.             Point var3 = var1.getPoint();
  29.             int var4 = this.this$0.table.rowAtPoint(var3);
  30.             int var5 = this.this$0.table.columnAtPoint(var3);
  31.             if (var5 == -1 || var4 == -1) {
  32.                return;
  33.             }
  34.  
  35.             BasicTableUI.access$0(this.this$0.table, var4, var5, false, true);
  36.          }
  37.  
  38.       }
  39.    }
  40.  
  41.    public void mouseEntered(MouseEvent var1) {
  42.    }
  43.  
  44.    public void mouseExited(MouseEvent var1) {
  45.    }
  46.  
  47.    public void mouseMoved(MouseEvent var1) {
  48.    }
  49.  
  50.    public void mousePressed(MouseEvent var1) {
  51.       if (SwingUtilities.isLeftMouseButton(var1)) {
  52.          Point var2 = var1.getPoint();
  53.          int var3 = this.this$0.table.rowAtPoint(var2);
  54.          int var4 = this.this$0.table.columnAtPoint(var2);
  55.          if (var4 != -1 && var3 != -1) {
  56.             if (this.this$0.table.editCellAt(var3, var4, var1)) {
  57.                this.setDispatchComponent(var1);
  58.                this.repostEvent(var1);
  59.             } else {
  60.                this.this$0.table.requestFocus();
  61.             }
  62.  
  63.             TableCellEditor var5 = this.this$0.table.getCellEditor();
  64.             if (var5 == null || var5.shouldSelectCell(var1)) {
  65.                this.setValueIsAdjusting(true);
  66.                BasicTableUI.access$0(this.this$0.table, var3, var4, ((InputEvent)var1).isControlDown(), ((InputEvent)var1).isShiftDown());
  67.             }
  68.  
  69.          }
  70.       }
  71.    }
  72.  
  73.    public void mouseReleased(MouseEvent var1) {
  74.       if (SwingUtilities.isLeftMouseButton(var1)) {
  75.          this.repostEvent(var1);
  76.          this.dispatchComponent = null;
  77.          this.setValueIsAdjusting(false);
  78.       }
  79.    }
  80.  
  81.    private boolean repostEvent(MouseEvent var1) {
  82.       if (this.dispatchComponent == null) {
  83.          return false;
  84.       } else {
  85.          MouseEvent var2 = SwingUtilities.convertMouseEvent(this.this$0.table, var1, this.dispatchComponent);
  86.          this.dispatchComponent.dispatchEvent(var2);
  87.          return true;
  88.       }
  89.    }
  90.  
  91.    private void setDispatchComponent(MouseEvent var1) {
  92.       Component var2 = this.this$0.table.getEditorComponent();
  93.       Point var3 = var1.getPoint();
  94.       Point var4 = SwingUtilities.convertPoint(this.this$0.table, var3, var2);
  95.       this.dispatchComponent = SwingUtilities.getDeepestComponentAt(var2, var4.x, var4.y);
  96.    }
  97.  
  98.    private void setValueIsAdjusting(boolean var1) {
  99.       this.this$0.table.getSelectionModel().setValueIsAdjusting(var1);
  100.       this.this$0.table.getColumnModel().getSelectionModel().setValueIsAdjusting(var1);
  101.    }
  102. }
  103.